import { Component, Injector } from '@angular/core';
import { EntityDtoOfInt64, HomePageServiceProxy, VideoDto } from '@shared/service-proxies/service-proxies';
import { NotifyService } from '@abp/notify/notify.service';
import { AppConsts } from '@shared/AppConsts';
import { AppComponentBase } from '@shared/common/app-component-base';

@Component({
  templateUrl: './video.component.html',
  styleUrls: ['./video.component.css']
})
export class VideoComponent extends AppComponentBase {

  videos: VideoDto[];

  constructor(
    injector: Injector,
    private _notifyService: NotifyService,
    private _homepage: HomePageServiceProxy
  ) {
    super(injector);
    this.getPicture();
  }

  getPicture(): void {
    this.videos = new Array<VideoDto>();
    this._homepage.getVideos().subscribe(result => {
      result.items.forEach(item => {
        item.url = AppConsts.remoteServiceBaseUrl + item.url;
      });
      this.videos = result.items;
    });
  }

}

